<template>
    <div id="tree">
   

        <el-button type="info"  @click="RunCluster()">聚合</el-button>
          <el-button type="info"  @click="DestroyCluster()">删除聚合</el-button>
    </div>
</template>

<script>

import CesiumInit from "./index.js";

    export default {
        data() {
            return {
                defaultchecked: [1],
                data: [
                    {
                        id: 1,
                        label: "聚合效果",
                        children: []

                    },
                ],
                defaultProps: {
                    children: "children",
                    label: "label",
                },
            };
        },
        created() {
      
        },
        mounted() {
        //   DestroyCluster();
                debugger;
    CesiumInit.init(viewer); 
        },
        methods: {

               RunCluster() {
 this.DestroyCluster();
                debugger;
    CesiumInit.init(viewer);       
            },

         DestroyCluster() {

       viewer.entities.removeAll();
        viewer.dataSources.removeAll();
  }
        
        },
          beforeDestroy() {
   
  },
        destroyed() {

           debugger;
        //    viewer.entities.removeAll();
                viewer.entities.removeAll();
                 viewer.dataSources.removeAll();
        // viewer.imageryLayers.removeAll(true);
        }
    };
</script>
